﻿using System;
using System.Collections.Generic;
using System.Text;
using Anonym.Data;
using Anonym.Models.Common;
using Anonym.Models.Objects;
using SqlSugar;
using Microsoft.Extensions.DependencyInjection;

namespace Anonym.Service
{
    public class BaseService
    {
        //public Logger Logger { get; set; }
        public SqlSugarClient Db { get; set; }
        public IServiceProvider Sp { get; set; }
        /// <summary>
        /// 返回类
        /// </summary>
        public ReturnValue Result { get; set; }
        /// <summary>
        /// 后台登录后基础信息
        /// </summary>
        public CmsBasicsInfo CmsBasicsInfo { get; set; }

        public BaseService(IServiceProvider p)
        {
            Sp = p;
            //唯一创建Provider的地方
            Db = p.GetService<DbProvider>().GetInstance();
            CmsBasicsInfo = p.GetService<CmsBasicsInfo>();
            Result = new ReturnValue();
            //Hp = new HttpParameter();
            //Logger = new Logger();
        }
    }
}
